package com.augurit.wf.app.document.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.augurit.common.base.dao.BaseDao;
import com.augurit.wf.app.document.entity.Document;

@Repository
public class DocumentDao extends BaseDao<Document, Long>{

	 public List<Document> getChildrenDocs(Long id,String version){
		 List<Document> list = null;
			if(id != null && version != null ){
				String hql = "from Document doc where doc.cid =? and doc.version=?";
				list = this.find(hql,id,version);
				return list;
			}
			return list;
			
	 }
	 
	 public List<Document> findDocs(String version,String status){
		 List<Document> list = null;
			if(version != null && status != null ){
				String hql = "from Document doc where doc.version=? and doc.status =?";
				list = this.find(hql,version,status);
				return list;
			}else if( version != null){
				String hql = "from Document doc where doc.version=? ";
				list = this.find(hql,version);
				return list;
			
			}
			return list;
			
	 }
}
